{{include file ="admin/header.tpl"}}
{{include file ="admin/navibar.tpl"}}
{{include file ="admin/sidebar.tpl"}}

<div class="content">

    <!-- 表格头部开始 -->
    <div class="header">
        <div class="stats"><p class="stat"></p>
        </div>
        <h1 class="page-title">网站 SEO 设置</h1>
    </div>
    <!-- 表格头部结束 -->

	<div class="container-fluid">
		<div class="row-fluid">

            <div class="alert  alert-info fade in">
                <button type="button" class="close" data-dismiss="alert">×</button>
                <strong>变量提示!</strong>
                <p>网站名称:{website_name}首页标题:{home_title}，首页关键字:{home_keywords}，首页描述:{home_desc} </p>
                <p> 文章标题:{post_title}，文章摘要:{post_excerpt}，文章标签:{post_tags} </p>
                <p>当前分类:{category} 当前标签:{tag} 当前搜索关键字 {search} </p>

            </div>

            <ul class="nav nav-tabs" id="myTab">
                <li class="active">
                    <a href="#home" data-toggle="tab">首页SEO</a>
                </li>
                <li><a href="#categoryseo" data-toggle="tab">分类页SEO</a></li>
                <li><a href="#postseo" data-toggle="tab">文章页SEO</a></li>
                <li><a href="#tagseo" data-toggle="tab">标签页SEO</a></li>
            </ul>
            <div id="myTabContent" class="tab-content">
                <div class="tab-pane fade active in" id="home">
                    <p>
                    <form class="form-horizontal">
                        <div class="control-group">
                            <label class="control-label" for="indextitle">标题</label>
                            <div class="controls">
                                <input type="text" value="{{$params.home_title}}" id="home_title" placeholder="首页标题" class="input-xxlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="indexkeyword">关键字</label>
                            <div class="controls">
                                <input type="text"  value="{{$params.home_keywords}}"  id="home_keywords" placeholder="首页关键字" class="input-xxlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="indexkeyword">描述</label>
                            <div class="controls">
                                <textarea rows="10" style="width:450px" id="home_desc">{{$params.home_desc}}</textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <button type="button" class="btn btn-primary" onclick="updateSeo(0);">更新</button>
                            </div>
                        </div>
                    </form>
                    </p>
                </div>
                <div class="tab-pane fade" id="categoryseo">
                    <p>
                    <form class="form-horizontal">
                        <div class="control-group">
                            <label class="control-label" for="indextitle">标题</label>
                            <div class="controls">
                                <input type="text" id="category_title" value="{{$params.category_title}}" placeholder="分类页标题" class="input-xxlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="indexkeyword">关键字</label>
                            <div class="controls">
                                <input type="text" value="{{$params.category_keywords}}" id="category_keywords" placeholder="分类页关键字" class="input-xxlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="indexkeyword">描述</label>
                            <div class="controls">
                                <textarea rows="10" style="width:450px" id="category_desc">{{$params.category_desc}}</textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <button type="button" class="btn btn-primary" onclick="updateSeo(1);">更新</button>
                            </div>
                        </div>
                    </form>
                    </p>
                </div>
                <div class="tab-pane fade" id="postseo">
                    <p>
                    <form class="form-horizontal">
                        <div class="control-group">
                            <label class="control-label" for="indextitle">标题</label>
                            <div class="controls">
                                <input type="text" id="post_title" value="{{$params.post_title}}" placeholder="文章页标题" class="input-xxlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="indexkeyword">关键字</label>
                            <div class="controls">
                                <input type="text" value="{{$params.post_keywords}}"  id="post_keywords" placeholder="文章页关键字" class="input-xxlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="indexkeyword">描述</label>
                            <div class="controls">
                                <textarea rows="10" style="width:450px" id="post_desc">{{$params.post_desc}}</textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <button type="button" class="btn btn-primary" onclick="updateSeo(2);">更新</button>
                            </div>
                        </div>
                    </form>
                    </p>
                </div>
                <div class="tab-pane fade" id="tagseo">
                    <p>
                    <form class="form-horizontal">
                        <div class="control-group">
                            <label class="control-label" for="indextitle">标题</label>
                            <div class="controls">
                                <input type="text" id="tag_title" value="{{$params.tag_title}}" placeholder="TAG页标题" class="input-xxlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="indexkeyword">关键字</label>
                            <div class="controls">
                                <input type="text" id="tag_keywords" value="{{$params.tag_keywords}}"  placeholder="TAG页关键字" class="input-xxlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="indexkeyword">描述</label>
                            <div class="controls">
                                <textarea rows="10" style="width:450px" id="tag_desc">{{$params.tag_desc}}</textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <button type="button" class="btn btn-primary" onclick="updateSeo(3);">更新</button>
                            </div>
                        </div>
                    </form>
                    </p>
                </div>
            </div>

        </div>
	</div>
</div>

<script src="{{$smarty.const.WEBSITE_URL}}public/assets/layer/layer.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("[href^='#']").click(function (){location.hash=$(this).attr("href"); return false;});
        $('#myTab a').click(function (e) {
            e.preventDefault();
            $(this).tab('show');
        })
    });
 function updateSeo(formtype){
     var obj={};
     //index
     if(formtype == 0){
         obj.formtype=0;
         obj.title = $("#home_title").val();
         obj.keywords = $("#home_keywords").val();
         obj.desc = $("#home_desc").val();
      //category
     }else if(formtype == 1){
         obj.formtype=1;
         obj.title = $("#category_title").val();
         obj.keywords = $("#category_keywords").val();
         obj.desc = $("#category_desc").val();
     }//post
    else if(formtype == 2){
         obj.formtype=2;
         obj.title = $("#post_title").val();
         obj.keywords = $("#post_keywords").val();
         obj.desc = $("#post_desc").val();
    }//tag
    else if(formtype == 3){
         obj.formtype=3;
         obj.title = $("#tag_title").val();
         obj.keywords = $("#tag_keywords").val();
         obj.desc = $("#tag_desc").val();
     }
        $.post('admin/seo/update', obj,
             function( data ) {
                 if(data.success){
                         $.layer({
                             area : ['auto','auto'],
                             dialog : {msg:'设置成功',type : 1}
                         });
                 }else{
                     $.layer({
                         area : ['auto','auto'],
                         dialog : {msg:'设置失败',type : 1}
                     });
                 }
             },  "json");
 }
</script>
{{include file="admin/footer.tpl" }}

